Skip to content

test(common): cover case-aware is_kotor_install_dir detection#310

Draft
cursor[bot] wants to merge 1 commit into
masterfrom
impl/missing-test-coverage-4719
Draft

test(common): cover case-aware is_kotor_install_dir detection#310
cursor[bot] wants to merge 1 commit into
masterfrom
impl/missing-test-coverage-4719

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 29, 2026

Summary

Adds regression tests for KOTOR install directory detection after PR #151 switched is_kotor_install_dir to CaseAwarePath in three call sites.

Risky behavior now covered

  • Install detection used by diff CLI, patching tools, and TSLPatcher diff engine to decide whether a path is a game root (chitin.key present).
  • Case-insensitive paths on POSIX: mismatched install directory name and mismatched chitin.key filename (e.g. CHITIN.KEY).
  • Negative cases: missing path, empty directory, and file (non-directory) paths.

Test files added/updated

  • Libraries/PyKotor/tests/common/test_is_kotor_install_dir.py (new, 18 parametrized tests across cli_utils, patching, and diff.engine)

Why this reduces regression risk

These helpers gate high-blast-radius flows (patching installs, diff against game roots). A regression in CaseAwarePath integration could silently treat valid installs as invalid on Linux/macOS mod layouts with case drift. The tests lock the intended behavior without requiring a full KOTOR installation fixture.

Validation

QT_QPA_PLATFORM=offscreen uv run --directory Libraries/PyKotor pytest --import-mode=importlib tests/common/test_is_kotor_install_dir.py -v

18 passed (POSIX case tests skipped on Windows by design).

Open in Web View Automation 

Co-authored-by: PuritanWizard <th3w1zard1@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Message that will be displayed on users' first pull request

@github-actions github-actions Bot added python Pull requests that update python code libraries size/S Small PR (30-100 lines) labels May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔨 Build Validation Summary

Version Check: Passed

Tool Builds

⚠️ HoloPatcher: cancelled
⚠️ HoloPazaak: cancelled
⚠️ HolocronToolset: cancelled
⚠️ KotorDiff: cancelled
⚠️ KotorMCP: cancelled


🎉 All builds validated successfully! This PR is ready for merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libraries python Pull requests that update python code size/S Small PR (30-100 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant